/*
 * Created by JFormDesigner on Sun Mar 04 13:32:38 GMT 2007
 */

package mv.releaser.view;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

import mv.releaser.controler.ControlerMvReleaser;

import com.jgoodies.forms.factories.*;
import com.jgoodies.forms.layout.*;

/**
 * @author kal kal
 */
public class AboutWindow extends JFrame {
	private ControlerMvReleaser controler;
	
	public AboutWindow(ControlerMvReleaser controler) {
		this.controler = controler;
		initComponents();
		licenceTextArea.setCaretPosition(0);
	}

	private void thisWindowClosing(WindowEvent e) {
		controler.aboutClosing();
	}

	private void okButtonActionPerformed(ActionEvent e) {
		controler.aboutClosing();
	}

	private void initComponents() {
		// JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
		// Generated using JFormDesigner Evaluation license - kal kal
		dialogPane = new JPanel();
		contentPanel = new JPanel();
		label1 = new JLabel();
		label3 = new JLabel();
		label4 = new JLabel();
		scrollPane1 = new JScrollPane();
		licenceTextArea = new JTextArea();
		label2 = new JLabel();
		buttonBar = new JPanel();
		okButton = new JButton();
		CellConstraints cc = new CellConstraints();

		//======== this ========
		setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent e) {
				thisWindowClosing(e);
			}
		});
		Container contentPane = getContentPane();
		contentPane.setLayout(new BorderLayout());

		//======== dialogPane ========
		{
			dialogPane.setBorder(Borders.DIALOG_BORDER);

			// JFormDesigner evaluation mark
//			dialogPane.setBorder(new javax.swing.border.CompoundBorder(
//				new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
//					"JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
//					javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),
//					java.awt.Color.red), dialogPane.getBorder())); dialogPane.addPropertyChangeListener(new java.beans.PropertyChangeListener(){public void propertyChange(java.beans.PropertyChangeEvent e){if("border".equals(e.getPropertyName()))throw new RuntimeException();}});

			dialogPane.setLayout(new BorderLayout());

			//======== contentPanel ========
			{
				contentPanel.setLayout(new FormLayout(
					ColumnSpec.decodeSpecs("default:grow"),
					new RowSpec[] {
						FormFactory.DEFAULT_ROWSPEC,
						FormFactory.RELATED_GAP_ROWSPEC,
						FormFactory.DEFAULT_ROWSPEC,
						FormFactory.LINE_GAP_ROWSPEC,
						FormFactory.DEFAULT_ROWSPEC,
						FormFactory.LINE_GAP_ROWSPEC,
						FormFactory.UNRELATED_GAP_ROWSPEC,
						FormFactory.LINE_GAP_ROWSPEC,
						new RowSpec(RowSpec.CENTER, Sizes.dluY(55), FormSpec.DEFAULT_GROW),
						FormFactory.LINE_GAP_ROWSPEC,
						FormFactory.UNRELATED_GAP_ROWSPEC,
						FormFactory.LINE_GAP_ROWSPEC,
						FormFactory.DEFAULT_ROWSPEC
					}));

				//---- label1 ----
				label1.setText("MvReleaser 1.0 beta1");
				label1.setFont(new Font("Dialog", Font.PLAIN, 24));
				label1.setHorizontalAlignment(SwingConstants.CENTER);
				contentPanel.add(label1, cc.xy(1, 1));

				//---- label3 ----
				label3.setText("MvReleaser is a packager for music videos.");
				contentPanel.add(label3, cc.xywh(1, 3, 1, 1, CellConstraints.CENTER, CellConstraints.DEFAULT));

				//---- label4 ----
				label4.setText("It creates the directory matching the release name, and generates a sfv/nfo file. ");
				label4.setHorizontalAlignment(SwingConstants.CENTER);
				contentPanel.add(label4, cc.xy(1, 5));

				//======== scrollPane1 ========
				{

					//---- licenceTextArea ----
					licenceTextArea.setEditable(false);
					licenceTextArea.setText("This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\n============================================\n\nMvReleaser is designed for packaging music videos releases. Its goal is to create the directory according to the release name, including SFV/NFO generation. It fills the nfo with artist, title, release date, video year, video details (length, resolution) and more options. It supports AVI file format and MKV support will come.\n\nMvReleaser is avalaible in english and french translation will be avalaible with final release.");
					licenceTextArea.setLineWrap(true);
					licenceTextArea.setWrapStyleWord(true);
					scrollPane1.setViewportView(licenceTextArea);
				}
				contentPanel.add(scrollPane1, cc.xywh(1, 9, 1, 1, CellConstraints.DEFAULT, CellConstraints.FILL));

				//---- label2 ----
				label2.setText("Author : Kal");
				label2.setHorizontalAlignment(SwingConstants.CENTER);
				contentPanel.add(label2, cc.xy(1, 13));
			}
			dialogPane.add(contentPanel, BorderLayout.CENTER);

			//======== buttonBar ========
			{
				buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
				buttonBar.setLayout(new FormLayout(
					new ColumnSpec[] {
						FormFactory.GLUE_COLSPEC,
						FormFactory.BUTTON_COLSPEC
					},
					RowSpec.decodeSpecs("pref")));

				//---- okButton ----
				okButton.setText("Close");
				okButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						okButtonActionPerformed(e);
					}
				});
				buttonBar.add(okButton, cc.xy(2, 1));
			}
			dialogPane.add(buttonBar, BorderLayout.SOUTH);
		}
		contentPane.add(dialogPane, BorderLayout.CENTER);
		pack();
		setLocationRelativeTo(getOwner());
		// JFormDesigner - End of component initialization  //GEN-END:initComponents
	}

	// JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
	// Generated using JFormDesigner Evaluation license - kal kal
	private JPanel dialogPane;
	private JPanel contentPanel;
	private JLabel label1;
	private JLabel label3;
	private JLabel label4;
	private JScrollPane scrollPane1;
	private JTextArea licenceTextArea;
	private JLabel label2;
	private JPanel buttonBar;
	private JButton okButton;
	// JFormDesigner - End of variables declaration  //GEN-END:variables
}
